package com.bjsxt.chapter19_observer;

/**
 * @ClassName ObserverA
 * @Description 观察者A，具体的观察者
 * @Author 黑马程序员
 * @Date 15:09 2024/6/25
 * @Version 1.0
 **/
public class ObserverA implements Observer{

    // myState需要和目标对象的state值保持一致!
    private int myState;

    @Override
    public void update(Subject subject) {
        myState = ((ConcreteSubject)subject).getState();
    }

    public int getMyState() {
        return myState;
    }

    public void setMyState(int myState) {
        this.myState = myState;
    }
}
